<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./js/vue.js"></script>
</head>

<body>

  <div id="app">

    <h2 v-for="item in titleList">
      {{item}}
    </h2>

    <button @click.once="addTitle">点我添加一行</button>

    <hr>

    <button @click="addBtn">点我添加一个按钮</button>

    <button v-for="item in btnList">{{item}}</button>


  </div>

  <script>
    new Vue({
      el: "#app",
      data: {
        titleList: [],
        btnList: []
      },

      methods: {

        addTitle () {
          this.titleList.push("这是新增的标题")
        },

        addBtn () {
          this.btnList.push("这是新增的按钮")
        }

      }
    })
  </script>

</body>

</html>